#include "gtest/gtest.h"
#include "library2/libopt.h"

using namespace std;
using namespace basic::library2;

extern int gArgc;
extern const char **gArgv;

TEST(OptTest, Overall)
{
    CCommandOption co(gArgc, gArgv, "ab:c?");
    EXPECT_EQ(true, co.HasOption('a'));
    EXPECT_EQ(true, co.HasOption('b'));
    EXPECT_EQ(true, co.HasOption('c'));
    EXPECT_EQ(false, co.HasOption('A'));

    string sb, sc;
    co.GetValue('b', sb);
    co.GetValue('c', sc, "ccx");
    EXPECT_EQ("sb", sb);
    EXPECT_EQ("ccx", sc);
}
